/**
 * @see [](https://mp.weixin.qq.com/debug/wxadoc/dev/api/card.html#wxaddcardobject)
 */
export default function add_card(cardList: Array<{ cardId: string; cardExt: wx.CardExe; }>) {
	return new Promise<boolean>((resolve, reject) => {
		wx.addCard({
			cardList: cardList.map((card) => {
				return {
					cardExt: JSON.stringify(card.cardExt),
					cardId: card.cardId
				};
			}),
			success() {
				resolve(true);
			},
			fail() {
				reject(false);
			}
		});
	});
}
